
package org.eagleeyes.hoverbuttons;

/**
 * Represents a focusable item in Eagle Eyes.  
 * @author Jesse Bahr
 */
public class EEFocusable {
  private int x;
  private int y;
  private int width;
  private int height;
  
  private EEFocusableListener listener;
  
  public EEFocusable(){
    listener = new NullEEFocusableListener();
  }

  public EEFocusable(EEFocusableListener listener) {
    this.listener = listener;
  }
  
  public EEFocusable(EEFocusableListener listener, int x, int y, int width, int height) {
    this.listener = listener;
    this.x = x;
    this.y = y;
    this.width = width;
    this.height = height;
  }
  

  public int getX() {
    return x;
  }

  public void setX(int x) {
    this.x = x;
  }

  public int getY() {
    return y;
  }

  public void setY(int y) {
    this.y = y;
  }

  public int getWidth() {
    return width;
  }

  public void setWidth(int width) {
    this.width = width;
  }

  public int getHeight() {
    return height;
  }

  public void setHeight(int height) {
    this.height = height;
  }

  public EEFocusableListener getListener() {
    return listener;
  }
  
  public void setListener(EEFocusableListener l){
    listener = l;
  }
  
  public boolean contains(int x, int y){
    return (x >= this.x && x - this.x < width &&
        y >= this.y && y - this.y < height);
  }

}
